import { Widget } from '@/models'
import { DocData, PageData, SignData, SignOptions, Viewer } from '@/types'
import { PopoverType } from './useWidgetPopover'

export default {
  /** 文档滚动 */
  scroll: (e: Event, pageIndex: number) => undefined,

  /** 文档缩放 */
  zoom: (level: number) => undefined,

  /** 页面点击 */
  'page-click': ({ doc, page, p }: { doc: DocData; page: PageData; p: number }) => undefined,

  /** 控件拖入 */
  'widget-drop': (widget: Widget) => undefined,

  /** 控件激活 */
  'widget-active': (widget: Widget | undefined) => undefined,

  /** 控件点击 */
  'widget-click': (widget: Widget, e: MouseEvent) => undefined,

  /** 控件点击，支持点击区域的多个控件 */
  'widgets-click': (widgets: Widget[], e: MouseEvent) => undefined,

  /** 控件新增 */
  'widget-add': (widget: Widget) => undefined,

  /** 控件移除 */
  'widget-remove': (widget: Widget) => undefined,

  /** 控件选择改变 */
  'widget-select': (selected: Widget[]) => undefined,

  /** 签章切换 */
  'sign-change': (widget: Widget, sign: SignData, signGlobal: boolean, changedWidgets: Widget[]) => undefined,

  /** 日期章配置更改 */
  'date-sign-set': (widget: Widget, signOptions: SignOptions) => undefined,

  /** 控件批量应用 */
  'batch-apply': (widget: Widget, selected: DocData[], applyPage?: string) => undefined,

  /** 快捷键 */
  hotkey: (arg: { e: Event; viewer: Viewer }) => undefined,

  /** 弹出层打开 */
  'popover-open': (type: PopoverType, el: HTMLElement, widget: Widget) => undefined,

  /** docIndex.sync */
  'update:docIndex': (index: number) => undefined
}
